package com.ihrm.domain.system.response;

import com.ihrm.domain.system.Role;
import com.ihrm.domain.system.User;
import lombok.Getter;
import lombok.Setter;
import org.springframework.beans.BeanUtils;

import javax.persistence.Id;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

@Getter
@Setter
public class UserResult implements Serializable {


    @Id
    private String id;

    private String mobile;

    private String username;

    private String password;

   //启用状态 0为禁用 1为启用

    private Integer enableState;

    private Date createTime;

    private String companyId;

    private String companyName;


    private String departmentId;


    private Date timeOfEntry;


    private Integer formOfEmployment;


    private String workNumber;


    private String formOfManagement;


    private String workingCity;

    /**
     * 转正时间
     */
    private Date correctionTime;

    /**
     * 在职状态 1.在职  2.离职
     */
    private Integer inServiceStatus;

    private String departmentName;

    private List<String> roleIds = new ArrayList<>();

    public UserResult(User user) {
        BeanUtils.copyProperties(user,this);
        for (Role role : user.getRoles()) {
            this.roleIds.add(role.getId());
        }
    }
}
